{include file="layout/layout" /}
<body style="background-color: #FFF; overflow: auto;">
<div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
    <div class="fixed-bar">
        <div class="item-title"><a class="back" href="javascript:history.back();" title="返回列表"><i class="fa fa-arrow-circle-o-left"></i></a>
            <div class="subject">
                <h3>商户管理 - 修改商户信息</h3>
                <h5>商城系统商户信息</h5>
            </div>
        </div>
    </div>
    <form action="?act=u" method='post' enctype="multipart/form-data" id='roleform'>
    <input type="hidden" name="sp_id" value="{:input('param.id')}">
    <div class="ncap-form-default">
        <dl class="row">
            <dt class="tit">
                <label>商户编号</label>
            </dt>
            <dd class="opt"><strong style='color:black'>{$shop.sp_number}</strong></dd>
        </dl>
        <dl class="row">
            <dt class="tit">
                <label>登录账号</label>
            </dt>
            <dd class="opt"><strong style='color:black'>{$shop.sp_username}</strong></dd>
        </dl>
        <dl class="row">
            <dt class="tit">
                <label>店铺名称</label>
            </dt>
            <dd class="opt">
                <input class="input-txt" datatype="*" nullmsg="请填写店铺名称方便用户搜索" name="sp_name" value="{$shop.sp_name}" type="text">
            </dd>
        </dl>
        <dl class="row">
            <dt class="tit">
                <label>手机号</label>
            </dt>
            <dd class="opt">
                <!-- <input class="input-txt" datatype="/(13[0-9])\d{8}|(15[0-9])\d{8}|(17[0,3,6,7,8])\d{8}|(14[5,7])\d{8}|(18[0-9])\d{8}/" name="sp_mobile" nullmsg="请填写负责人手机号" errormsg="手机格式不正确" value="{$shop.sp_mobile}" type="text"> -->
                <input class="input-txt" name="sp_mobile" value="{$shop.sp_mobile}" type="text" id='mobile'>
                <span class="Validform_checktip Validform_wrong" id='m_error' style='display:none'>手机格式不正确</span>
            </dd>
        </dl>
        <dl class="row">
            <dt class="tit">
                <label>店主姓名</label>
            </dt>
            <dd class="opt">
                <input class="input-txt" datatype="*" name="sp_true_name" value="{$shop.sp_true_name}" nullmsg="负责人姓名必须填写" type="text">
            </dd>
        </dl>
        <dl class="row">
            <dt class="tit">
                <label>公司名称</label>
            </dt>
            <dd class="opt">
                <input class="input-txt" name="sp_company" value="{$shop.sp_company}" datatype="*" nullmsg="注册名称必填，客服会进行核实" type="text">
            </dd>
        </dl>
        <dl class="row">
            <dt class="tit">
                <label>公司法人</label>
            </dt>
            <dd class="opt">
                <input class="input-txt" name="sp_legal_person" value="{$shop.sp_legal_person}" datatype="*" nullmsg="法人必填，客服会进行核实" type="text">
            </dd>
        </dl>
        <dl class="row">
            <dt class="tit">
                <label class="code_url">店铺LOGO</label>
            </dt>
            <dd class="opt">
                {if $shop.sp_logo_url}
                    <a href="__ROOT__{$shop.sp_logo_url}"><img src="__ROOT__{$shop.sp_logo_url}" width='150' height='auto' title='点击查看图片'></a>
                {else/}
                    <input class="input-txt valid" name="logo" type="file">
                {/if}
            </dd>
        </dl>
        <dl class="row">
            <dt class="tit">
                <label>营业执照编号</label>
            </dt>
            <dd class="opt">
                <input class="input-txt" name="sp_bus_license" value="{$shop.sp_bus_license}" datatype="*" nullmsg="营业执照编号必填，客服会进行核实" type="text">
            </dd>
        </dl>
        <dl class="row">
            <dt class="tit">
                <label class="code_url">营业执照</label>
            </dt>
            <dd class="opt">
                {if $shop.sp_bus_license_url}
                    <a href="__ROOT__{$shop.sp_bus_license_url}"><img src="__ROOT__{$shop.sp_bus_license_url}" width='150' height='auto' title='点击查看图片'></a>
                    <input class="input-txt" name="image" type="file">
                {else/}
                    <input class="input-txt" datatype="*" nullmsg="营业执照必须上传" name="image" type="file">
                {/if}
            </dd>
        </dl>
        <dl class="row">
            <dt class="tit">
                <label>商户电话</label>
            </dt>
            <dd class="opt">
                <!-- <input class="input-txt" name="sp_phone" value="{$shop.sp_phone}" datatype="/^(0?(13[0-9]|15[012356789]|17[013678]|18[0-9]|14[57])[0-9]{8})|(400|800)([0-9\\-]{7,10})|(([0-9]{4}|[0-9]{3})(-| )?)?([0-9]{7,8})((-| |转)*([0-9]{1,4}))?$/" nullmsg="商户电话必填" type="text"> -->
                <input class="input-txt" name="sp_phone" value="{$shop.sp_phone}" type="text" id='phone'>
                <span class="Validform_checktip Validform_wrong" id='p_error' style='display:none'>电话格式不正确</span>
            </dd>
        </dl>
        <dl class="row">
            <dt class="tit">
                <label>所属区域</label>
            </dt>
            <dd class="opt">
                <strong style='color:black'>{$shop.merger_name}</strong>
            </dd>
        </dl>
        <dl class="row">
            <dt class="tit">
                <label>修改区域</label>
            </dt>
            <dd class="opt">
                <select onblur="get_ajax_city(this)" id="province"  name="sp_area_id" >
                    <option value="0">选择区域</option>
                    {foreach $areas as $k=>$v}
                    <option value="{$v['id']}">{$v['merger_name']}</option>
                    {/foreach}
                </select>
            </dd>
        </dl>
        <dl class="row">
            <dt class="tit">
                <label>商户地址</label>
            </dt>
            <dd class="opt">
                <input class="input-txt" name="sp_address" value="{$shop.sp_address}" datatype="*" nullmsg="商户地址不能为空" type="text">
            </dd>
        </dl>
        <dl class="row">
            <dt class="tit">
                <label>商户分类</label>
            </dt>
            <dd class="opt">
                <select name="sp_tyid" id="" required>
                    <option value="0">—— 请选择 ——</option>
                    {foreach $cates as $k=>$v}
                    <option value="{$v.ty_id}" {if $shop.sp_tyid==$v.ty_id}selected{/if}>{$v.ty_name}</option>
                    {/foreach}
                </select>
            </dd>
        </dl>
        <dl class="row">
            <dt class="tit">
                <label>状态</label>
            </dt>
            <dd class="opt">
                <input value="1" name="sp_status" id="gender" type="radio" {if $shop.sp_status==1}checked{/if}>
                <label for="gender">正常</label>
                <input value="2" name="sp_status" id="gender" type="radio" {if $shop.sp_status==2}checked{/if}>
                <label for="gender">禁用</label>
            </dd>
        </dl>
        <dl class="row">
            <dt class="tit">
                <label>APPID</label>
            </dt>
            <dd class="opt"><strong class="red">{$shop.sp_appid}</strong></dd>
        </dl>
        <dl class="row">
            <dt class="tit">
                <label>OpenID</label>
            </dt>
            <dd class="opt"><strong class="red">{$shop.sp_openid}</strong></dd>
        </dl>
        <dl class="row">
            <dt class="tit">
                <label>营业时间</label>
            </dt>
            <dd class="opt">
                <input type="time" name="sp_start_time" value="{$shop.sp_start_time}"> ~ <input type="time" name="sp_end_time" value="{$shop.sp_end_time}">
            </dd>
        </dl>
        {if $shop.sp_audit}
        <dl class="row">
            <dt class="tit">
                <label>审核时间</label>
            </dt>
            <dd class="opt"><strong class="red">{$shop.sp_audit_time|date='Y-m-d H:i:s'}</strong></dd>
        </dl>
        {/if}
        {if $shop.sp_audit==0}
        <dl class="row">
            <dt class="tit">
                <label>审核</label>
            </dt>
            <dd class="opt">
                <div class="onoff">
                    <label for="is_distribut1" class="cb-enable{if $shop.sp_audit==1} selected{/if}"><span>允许</span></label>
                    <label for="is_distribut2" class="cb-disable{if $shop.sp_audit==-1} selected{/if}"><span>拒绝</span></label>
                    <input id="is_distribut1" {if $shop.sp_audit!=1}name="sp_audit"{/if} value="1" type="radio" >
                    <input id="is_distribut2" {if $shop.sp_audit!=-1}name="sp_audit"{/if} value="-1" type="radio" >
                </div>
            </dd>
        </dl>
        {/if}
        <dl class="row">
            <dt class="tit">
                <label>最近登录时间</label>
            </dt>
            <dd class="opt"><strong class="red">{$shop.sp_login_time|date='Y-m-d H:i:s'}</strong></dd>
        </dl>
        <dl class="row">
            <dt class="tit">
                <label>注册时间</label>
            </dt>
            <dd class="opt"><strong class="red">{$shop.sp_create_time|date='Y-m-d H:i:s'}</strong></dd>
        </dl>
        <div class="bot"><button id="button" style="width:96px;height:35px;background: #4FC0E8;border-radius:5px;line-height:35px;text-align: center;color:#fff;border: 0;font-size: 15px;">确认提交</button></div>
    </div> 
    </form>
</div>
<script>
    $(document).ready(function() {
        $('#roleform').Validform({
            tiptype: 3,
            beforeSubmit: function (data) {
                var check = 1;
                var mobile = $('#mobile').val();
                var res1 = /(13[0-9])\d{8}|(15[0-9])\d{8}|(17[0,3,6,7,8])\d{8}|(14[5,7])\d{8}|(18[0-9])\d{8}/;
                if(mobile && !res1.test(mobile)){
                    $('#m_error').show();
                    check++;
                }else{
                    $('#m_error').hide();
                }
                var phone = $('#phone').val();
                var res2 = /^(0?(13[0-9]|15[012356789]|17[0-9]|18[0-9]|14[57])[0-9]{8})|(400|800)([0-9\\-]{7,10})|(([0-9]{4}|[0-9]{3})(-| )?)?([0-9]{7,8})((-| |转)*([0-9]{1,4}))?$/;
                if(phone && !res2.test(phone)){
                    $('#p_error').show();
                    check++;
                }else{
                    $('#p_error').hide();
                }
                if(check > 1){
                    return false;
                }else{
                    return true;
                }
            }
        });
    })
    /**
     * 获取城市
     * @param t  省份select对象
     */
    function get_ajax_city(t){
        var parent_id = $(t).val();
        if(parent_id == 0){
            $('#city').empty().html("<option>请选择城市</option>");
            $('#district').empty().html("<option>请选择区域</option>");
            return false;
        }
        $.ajax({
            url  : SCOPE.url_ajax_city,
            type : "GET",
            data : {'controller':parent_id},
            dataType:'html',
            error: function(request) {
                alert("服务器繁忙, 请联系管理员!");
                return;
            },
            success:function(v){
                v = '<option>请选择城市</option>'+ v;
                $('#city').empty().html(v);
            }
        });
    }

    /**
     * 获取地区
     * @param t  城市select对象
     */
    function get_ajax_area(t){
        var parent_id = $(t).val();
        if(parent_id == 0){
            $('#district').empty().html("<option>请选择区域</option>");
            return;
        }
        $.ajax({
            type : "GET",
            url  : SCOPE.url_ajax_area,
            data : {'controller':parent_id},
            dataType  : 'html',
            error: function(request) {
                alert("服务器繁忙, 请联系管理员!");
                return;
            },
            success: function(v) {
                v = '<option>请选择区域</option>'+ v;
                $('#district').empty().html(v);
            }
        });
    }
</script>

</body></html>